$(document).ready(function() {
	$(window).scroll(function(){
		$(".photoListItem").each(function() {
			var s = $(window).scrollTop();
			var thiss = $(this);
			var info = $(".info", this);
			if (thiss.offset().top - 60 < s && s < thiss.offset().top - 60 + thiss.outerHeight()) {
				if (s + info.outerHeight() < thiss.offset().top + thiss.outerHeight() - 70) {
					info.css({ position: "fixed", top: "60px" });
				} else {
					info.css({ position: "relative", top: "10px" });
				}
			} else {
				info.css({ position: "relative", top: "10px" });
			}
		});
		// For Side bar
		var s = $(window).scrollTop();
		if($("#list-fixed").length > 0){
			var ads = $("#list-fixed").offset().top;
			if(s >= ads){
				$("#box-fixed").css({ position: "fixed", top: "60px" });
			}else {
				$("#box-fixed").css({ position: "inherit"});
			}
		}
		if($("#container-fixed").length > 0){
			var likeThis = $("#container-fixed").offset().top;
			if(s >= likeThis){
				$("#content-fixed").css({ position: "fixed", top: "50px" });
			}else {
				$("#content-fixed").css({ position: "inherit", top: "0px" });
			}
		}
	});
	// Show password
	$(".showPassword").mousedown(function(event) {
		$(this).parent().children('input[type=password]').attr({
			type: 'text'
		});
	});
	$(".showPassword").mouseup(function(event) {
		$(this).parent().children('input[type=text]').attr({
			type: 'password'
		});
	});
});